package practise;
import java.util.Scanner;

public class Test {
    public static boolean isLeapYear(int year) {
        if(year%4==0 && year%100!=0 || year%400==0) {
            return true;
        }
        return false;
    }
    public static int isDays(int year, int month, int day) {
        int[] days = {0,31,28,31,30,31,30,31,31,30,31,30,31};
        if(isLeapYear(year)) {
            //是闰年
            days[2] += 1;
        }
        int ret = 0;
        for(int i = 1; i <month; i++) {
            ret+=days[i];
        }
        ret+=day;
        return ret;
    }
    public static void main(String[] args) {
        //编写程序，对输入的年、月、日，给出该天是该年的第多少天？
        Scanner scanner = new Scanner(System.in);
        int year = scanner.nextInt();
        int month = scanner.nextInt();
        int day = scanner.nextInt();
        System.out.println(isDays(year, month, day));
    }
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String ch = scanner.nextLine();
        ch.toUpperCase();
    }
}
